home *** CD-ROM | disk | FTP | other *** search
-
- Bubble Help window system for Visual Basic
- Version 0.1 1/1/92 by Mark Gamber
-
- *-----------------------------------------------------------------------------*
-
- A feature I liked in C but found unacceptable slow in Visual Basic was a
- small window available for short text messages such as on the spot help or
- information. So I concocted this "Bubble Help" system for use from Visual Basic
- which pretty much does the same thing I do in C. What it amounts to is two
- functions from Visual Basic and a method of calling the functions. Allow me to
- expand a bit on this...
-
- In order to display and delete the windows, you need of method of doing so.
- The example provided uses the top level form and the MouseDown routine. If the
- mouse button is number 2, the right button, a global variable, wnd, is tested
- see if it's zero. If so, a call is made to CreateBubble() which returns the
- handle of the window created. The handle is then stored in wnd so there aren't
- a zillion windows all over the place. When MouseDown is called again with the
- button equal to 2, it again tests wnd for zero and, since it's not, calls
- DeleteBubble() to delete the window created before.
- This is the method I used and it works well. It works on any object that
- can support MouseDown routines, such as a picture button. You can use just
- about anything you'd like, however. Perhaps a key combination or double click
- from the mouse, for example.
-
- *-----------------------------------------------------------------------------*
-
- Since this is fairly easy to do from C, I aimed this primarily at Visual
- Basic. To use the DLL from Visual Basic, you need to do the following:
-
- In the Global module, enter these lines:
-
- Declare Function CreateBubble% Lib "bubble.dll" ( ByVal x%, ByVal y%,
- ByVal xs%, ByVal ys%,
- ByVal title$, ByVal txt$ )
- Declare Function DeleteBubble% Lib "bubble.dll" ( ByVal wnd% )
-
- Remember, the lines cannot be split as they are above. It's only for clarity.
- Once done, you may call the functions in this manner:
-
- wnd% = CreateBubble( xpos%, ypos%, xsize%, ysize%, title$, text$ )
-
- Variable wnd% is an integer type and is the handle of the window created. If an
- error occurred, the return value is ZERO. You MUST retain this value (if not
- ZERO) in order to later delete the window. Xpos and ypos set the window position
- and xsize and ysize set the size of the window. To prevent surprises, set the
- Visual Basic form ScaleMode to Pixels since that's what Windows uses to position
- the help window. Title$ is a string which is displayed in the caption of the
- help window and text$ is the actual text which appears in the window. The text$
- variable (or literal string) may be up to 256 characters and the same goes with
- the title, although that would look mighty ugly.
-
- *-----------------------------------------------------------------------------*
-
- When the text is displayed, it is automatically broken to fit within the size
- provided and will expand tabs embedded in the string. In addition, it is auto-
- -matically centered so all you need to provide is the raw text to display. If
- you are creating a relatively short window width-wise, be sure the window is
- high enough to display all the lines if the text is broken.
-
- *-----------------------------------------------------------------------------*
-
- Enough of that...it's time to play, I think. The best way to figure out how
- to use it is to try it. Hopefully, this will make someone (besides me) happy.
-
- *-----------------------------------------------------------------------------*
-
- As always, suggestions, complaints and general praise may be directed to me
- via America Online, mail address MarkG85. And, as always, this is completely
- free as long as you agree not to hold me liable for anything you think may have
- caused anything. That is, use at your own risk.
-
-